package org.domain.rescue2011.session;

import org.domain.rescue2011.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("nodeList")
public class NodeList extends EntityQuery<Node> {

	private static final String EJBQL = "select node from Node node";

	private static final String[] RESTRICTIONS = {
			"lower(node.type) like lower(concat(#{nodeList.node.type},'%'))",
			"lower(node.language) like lower(concat(#{nodeList.node.language},'%'))",
			"lower(node.title) like lower(concat(#{nodeList.node.title},'%'))", };

	private Node node = new Node();

	public NodeList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Node getNode() {
		return node;
	}
}
